<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Thông tin shop</title>
		<link rel="stylesheet" href="../css/reset.css" type="text/css" />
		<link rel="stylesheet" href="../css/common.css" type="text/css" />
		<link rel="stylesheet" href="../css/seller.css" type="text/css" />
		<script src="../scripts/jquery-1.5.2.min.js"></script>
		<script src="../scripts/common.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#btsua").bind("click", function()
				{
					var serverURL = "../BUS/xl_SanPham.php?MaSP=" + $("#idsanpham").attr("value") + "&Sua=1";
					$("#detail_content").load(serverURL);
				});
				$("#bthuycapnhat").bind("click", function()
				{
					if(confirm('Bạn không muốn cập nhật nữa'))
					{
						var serverURL = "../BUS/xl_SanPham.php?MaSP=" + $("#idsanpham").attr("value") + "&Sua=1";
						$("#detail_content").load(serverURL);
					}
				});
			});
			var xmlhttp;
	
			function GetXmlHttpObject()
			{
				if (window.XMLHttpRequest)
				{
					// code for IE7+, Firefox, Chrome, Opera, Safari
					return new XMLHttpRequest();
				}
				if (window.ActiveXObject)
				{
					// code for IE6, IE5
					return new ActiveXObject("Microsoft.XMLHTTP");
				}
				return null;
			}
			
			function Xoa()
			{
				xmlhttp = GetXmlHttpObject();
				if(xmlhttp == null)
				{
					alert("Browser do not support HTTP REQUEST");
					return;
				}
				if(confirm("Bạn có muốn xóa sản phẩm này không ?"))
				{
					var IdSanPham = document.getElementById("idsanpham").value; 
					var url = "../BUS/xl_SanPham.php?MaSP=" + IdSanPham + "&Xoa=1";
					xmlhttp.onreadystatechange=Xoa_Change;
					xmlhttp.open("GET",url,true);
					xmlhttp.send("null");
				}
			}
			
			function Xoa_Change()
			{
				if (xmlhttp.readyState==4)
				{
					alert("Đã xóa thành công !");
					
					window.location="safsf";
				}
			}
		</script>
	</head>
	<body>
		<div id="page">
			<?php
				include_once("../webconfig.php");
				include_once("../DAO/DataHelper.php");
				include_once("../DAO/DanhMucSanPham_DAO.php");
				include_once("../DAO/SanPham_DAO.php");
				include_once("../DAO/DataHelper.php");
				include_once("../UserControl/header.php");
				$listdanhmuc = DanhMucSanPham::DanhSachDanhMuc();
				$sanpham = null;
				if(isset($_REQUEST["MaSP"]))
					$sanpham = SanPham::ChiTietSanPham($_REQUEST["MaSP"]);
			?>

			<div id="content">
				<?php
					include_once("../UserControl_NguoiBan/MenuDanhMucChucNang.php");
				?>
				<div id="seller-shop-info" class="block layout-2col-col2">
					<div class="title">
					  <h3>Chi tiết sản phẩm</h3>
				</div>
				<div id='detail_content' class="content">
						<?php
							if($sanpham != null)
							{
								
						?>    
						<table width="90%" height="525" border="0" align="center">
							<tr>
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<td colspan="2" align="center"><h4>THÔNG TIN SẢN PHẨM</h4></td>
							</tr>
							
                            <tr>
								<td align="right" bgcolor="#CCCCCC" ><strong>Tên sản phẩm : </strong></td>
								<td bgcolor="#CCCCCC"><label style="font-weight:bold"><?php echo $sanpham->sp_ten; ?></label>
                                <input type="hidden" id="idsanpham" value='<?php echo $sanpham->sp_ma; ?>'/>
                                </td>
							</tr>
                            <tr>
								<td align="right" bgcolor="#CCCCCC" ><strong>Ngày tạo : </strong></td>
								<td bgcolor="#CCCCCC"><label style="font-weight:bold"><?php echo $sanpham->sp_ngay_tao; ?></label></td>
							</tr>
							<tr>
								<td align="right" bgcolor="#F2F2F2"><strong>Danh Mục : </strong></td>
								<td bgcolor="#F2F2F2"><label style="font-weight:bold"><?php echo $sanpham->sp_ten_danh_muc; ?></label>
								</td>
							</tr>
							<tr>
								<td align="right" bgcolor="#F2F2F2"><strong>Giá tiền :</strong></td>
								<td bgcolor="#F2F2F2"><label style="font-weight:bold"><?php echo $sanpham->sp_don_gia; ?></label></td>
							</tr>
							<tr>
								<td align="right" bgcolor="#F2F2F2"><strong>Đơn vị tính : </strong></td>
								<td bgcolor="#F2F2F2"><label style="font-weight:bold"><?php echo $sanpham->sp_don_vi_tinh; ?></label></td>
							</tr>
							<tr>
								<td align="right" bgcolor="#CCCCCC"><strong>Số lượng : </strong></td>
								<td bgcolor="#CCCCCC"><label style="font-weight:bold"><?php echo $sanpham->sp_so_luong; ?></label></td>
							</tr>
									
							<tr>
							<td align="right" bgcolor="#CCCCCC"><strong>Hình Mô Tả : </strong></td>
								<td bgcolor="#CCCCCC"><img src="<?php print GetUrl("images/$sanpham->sp_hinh_anh") ?>" />
									  
							</td>
									  
							</tr>
							<tr>
								<td height="70" align="right" bgcolor="#F2F2F2"><strong>Mô tả sản phẩm : </strong></td>
								<td bgcolor="#F2F2F2"><label style="font-weight:bold"><?php echo $sanpham->sp_mo_ta; ?></label></td>
							</tr>
								<td>&nbsp;</td>
								<td>
                                    <div style="float:left;padding-left:100px">
                                    	<img src="../images/Edit-Document-icon.png" style="cursor:pointer" id="btsua" />
                                    	<img src="../images/delete-icon1.png" style="cursor:pointer" name="delete" id="btdelete" onclick="Xoa()" />
                                    </div>
                                    							  
                                </td>
							</tr>
						</table>
                        <?php
							}
						?>
 						
					</div>
				</div>
			</div>
			<?php
				include_once("../UserControl/footer.php");
			?>
		</div>
	</body>
</html>